﻿@using GoodMan.Infrastructure.Entities.Entity;
@using GoodMan.Infrastructure.Entities.Enum;
@{
    Layout = "~/Views/Shared/_Main.cshtml";
}
<div class="row">
    @if (ViewBag.Success)
    {
        var user = (User)ViewBag.User;
            
        <div class="span12 text-center">
            <br />
            <br />
            <br />
            <br />
            <h3 class="text-success">
                恭喜您，您的账号已经激活成功！</h3>
            <span>您已经成为本站正式会员</span> <span>接下，您可以：&nbsp;&nbsp;&nbsp;</span> <a style="color: red;
                font-weight: bold;" href="/">查看今日推荐</a> <a style="color: green; font-weight: bold;"
                    href="">返回首页</a>
            <br />
            <br />
            <br />
            <br />
        </div>
    }
    else
    {
        <div class="span12 text-center">
            <br />
            <br />
            <br />
            <br />
            <h3 class="text-error">
                激活失败！</h3>
            <span>由于某些原因，您的账号激活失败。请参考以下原因，如果都不是，请与管理员联系</span>
            <hr />
        </div> 
        <div class="span12">
            <ul>
                <li>1、人为修改url值</li>
                <li>2、您是7天之前注册的。如果是，您可以<a href="javascript:;" onclick="resendactivation()" class="btn btn-primary btn-mini">重发激活邮件</a></li>
                <li>3、再次之前您申请过忘记并重置密码操作。如果是，您可以<a href="javascript:;" onclick="resendactivation()"
                    class="btn btn-primary btn-mini">重发激活邮件</a></li>
            </ul>
            <div style="display: none;" id="form">
                <div class="control-group">
                    <label class="control-label">
                        请输入用户名：</label>
                    <div class="controls">
                        <input type="text" class="span4" id="txtUsername" placeholder="输入您注册时使用的用户名" />
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">
                    </label>
                    <div class="controls">
                        <input type="button" class="btn btn-primary" onclick="doresend()" value="重新发送" />
                    </div>
                </div>
            </div>
        <br />
            <br />
            <br />
            <br />
        </div>
    }
</div>
@section tail{
    <script type="text/javascript">
        function resendactivation() {
            $('#form').show();
        }
        function doresend() {
            if ($('#txtUsername').val() == '') {
                $('#txtUsername').parent().parent().addClass('error');
                $('#txtUsername').parent().append($('<span>输入有误</span>'));
                return;
            }
            $.ajax({
                url: '/account/resend',
                method: 'get',
                data: { u: $('#txtUsername').val(), t: 0 },
                success: function (result) {
                    if (result == '1') {
                        window.location.href = '/account/operationdone?t=4';
                    }
                    else {
                        alert('用户不存在，请查证');
                    }
                }
            });
        }
    </script>
}
